package com.lifu.yygh.task.scheduled;

import com.lifu.common.rabbit.constant.MqConst;
import com.lifu.common.rabbit.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Description
 * @Author lifu
 * @Date 2021/5/27 13:12
 */
@Component
@EnableScheduling
public class ScheduledTask {
    @Autowired
    private RabbitService rabbitService;

    /**
     * 每天8点执行 提醒就诊
     */
    @Scheduled(cron = "0/30 * * * * ?")//用于测试，实际 0 0 8 * * ？
    public void taskPatient() {
        System.out.println("提醒就诊");
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK, MqConst.ROUTING_TASK_8, "");
    }

}
